package com.dyit.springcloud.hospital.doctor.service.imlp;

import com.dyit.springcloud.hospital.doctor.dao.IDeptDao;
import com.dyit.springcloud.hospital.domain.entity.Dept;
import com.dyit.springcloud.hospital.doctor.service.IDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class DeptServiceImpl implements IDeptService {

    @Autowired
    private IDeptDao idd;

    @Override
    public void addDept(Dept dept) {
        idd.save(dept);
    }

    @Override
    public List<Dept> findAllDept() {
        List<Dept> all = idd.findAll();
        return all;
    }

    @Override
    public Dept findDeptByName(String name) {
        Dept dept = idd.findDeptByName(name);
        return dept;
    }
}
